/*******************************************************************************
 * @file Tracer.cpp
 * Implementation of methods for class CTracer
 * 
 * @package Logging.
 * 
 * @author mk
 * @date 28/12/2008 13:50:21
 * @version 0.1
 ******************************************************************************/

#include "Tracer.h"
#include "Assert.h"
#include "Logging.h"
#include "Globals.h"

using namespace Logging;

CTracer::CTracer(char* aFile, unsigned int aLine, char* aFunc) : 
		  m_Location(aFile, aLine),
		  m_Func(aFunc)
{
	TRACE(m_Location.ToString() << " " << "Entering " << m_Func);
}

CTracer::~CTracer()
{
	using namespace Logging;

	if (std::uncaught_exception())
    {
		TRACE_ERROR(m_Location.ToString() << " " << m_Func << " has thrown");
    }  
    else
    {
		TRACE(m_Location.ToString() << " " << "Exiting " << m_Func);
    }
}

#if 0
CTracer::CLocation::CLocation(char* aFile, unsigned int aLine) : m_File(aFile), m_Line(aLine)
{
}

std::string CTracer::CLocation::ToString() const
{
	std::ostringstream os;
	os << m_File << " (" << m_Line << ")";
	return os.str();
}
#endif